<template>
  <span>
    <van-image
      v-for="(item, index) in fileList"
      :key="index"
      width="100"
      height="100"
      :src="item.url"
    ></van-image>
  </span>
</template>

<script>
import { queryFile } from "../../../utils/file";
export default {
  props: {
    equipFileId: {
      type: String,
    },
  },
  data() {
    return {
      // fileList: [
      //   {
      //     url: "https://img.yzcdn.cn/vant/leaf.jpg",
      //     name: "图片1",
      //   },
      // ],
      fileList: [], // 文件列表 主要存储已上传文件信息
    };
  },
  mounted() {
    // console.log(this.equipFileId);
  },
  methods: {
    queryFile() {
      queryFile({
        fatherId: this.equipFileId,
      })
        .then(({ code, message, data }) => {
          this.fileList = data || [];
        })
        .catch((err) => {
          this.fileList = [];
        });
    },
  },
  watch: {
    equipFileId: {
      handler() {
        if (this.equipFileId) {
          this.queryFile();
        }
      },
      immediate: true,
    },
  },
};
</script>

<style scoped>
.uploader >>> .van-field__control--custom {
  min-height: 88px;
}
</style>